package com.enhinck.dbutilweb.controller;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * 用户角色缓存
 *
 * @author hueb
 */
@Component("kaptchaCodeCache")
public class KaptchaCodeCache {
    @Resource
    private RedisTemplate<String, String> redisTemplate;

    private static final String CACHE_PREFIX = "KaptchaCode:";

    private int maximumSize = 0;


    public void save(String key, String value) {
        redisTemplate.opsForValue().set(CACHE_PREFIX+key, value, 60, TimeUnit.SECONDS);
    }
}